<%#
kind: PXEGrub2
name: Preseed default PXEGrub2
model: ProvisioningTemplate
oses:
- Debian
- Ubuntu
test_on:
- debian4dhcp
- ubuntu4dhcp
description: |
  The template to render Grub2 bootloader configuration for preseed based distributions.
  The output is deployed on the host's subnet TFTP proxy.
-%>
#
# This file was deployed via '<%= template_name %>' template

<%
  os_major = @host.operatingsystem.major.to_i
  os_name  = @host.operatingsystem.name

  if (os_name == 'Ubuntu' && os_major > 12 && os_major < 24) || (os_name == 'Debian' && os_major > 8 && os_major < 13)
    efi_suffix = 'efi'
  else
    efi_suffix = ''
  end
-%>
set default=0
set timeout=<%= host_param('loader_timeout') || 10 %>

menuentry '<%= template_name %>' {
  linux<%= efi_suffix %>  <%= @kernel %> interface=auto url=<%= foreman_url('provision')%> ramdisk_size=10800 root=/dev/rd/0 rw auto <%= snippet("preseed_kernel_options").strip %>
  initrd<%= efi_suffix %> <%= @initrd %>
}

<%= snippet_if_exists(template_name + " custom menu") %>
